package com.rgbgame.editor;

import processing.core.PApplet;

/**
 * Simple class to operate on 2d vectors.
 */

class Vector2d{
	public float x;
	public float y;

	public Vector2d(float _x, float _y){
		x=_x; y=_y;
	}

	public Vector2d(Vector2d vec){
		x=vec.x; y=vec.y;
	}
	
	public Vector2d cloneVec(){
		return new Vector2d(x,y);
	}

	public float distanceTo(Vector2d v){
		return PApplet.sqrt( (v.x-x)*(v.x-x)+(v.y-y)*(v.y-y) );
	}
	
	public void set(float _x, float _y){
		x = _x; y = _y;
	}
}